<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
	<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8">
	<TITLE></TITLE>
	<META NAME="GENERATOR" CONTENT="OpenOffice.org 3.2  (Unix)">
	<META NAME="CREATED" CONTENT="0;0">
	<META NAME="CHANGED" CONTENT="20110101;15130800">
	<STYLE TYPE="text/css">
	<!--
		@page { margin: 0.79in }
		P { margin-bottom: 0.08in }
		PRE { font-family: "Times New Roman" }
	-->
	</STYLE>
</HEAD>
<BODY LANG="el-GR" DIR="LTR">
<PRE LANG="en-US"><FONT SIZE=5><B>Eigenvalues-Eigenvectors Complex matrices</B></FONT>

<FONT SIZE=5><SPAN LANG="en-US"><B>eigcom</B></SPAN></FONT>


<FONT SIZE=4><SPAN LANG="en-US"><SPAN STYLE="font-style: normal">for</SPAN> details see book of Hang T. Lau, “A Java Numerical Library for Scientists and engineers|”, Chapman &amp; Hall, 2004</SPAN></FONT>

<FONT SIZE=4><SPAN LANG="en-US"><B>Example: Can be run with F5 within the ScalaLab Editor (Ctrl-E to open the editor)</B></SPAN></FONT>


<SPAN LANG="en-US">import java.text.DecimalFormat;</SPAN>
<SPAN LANG="en-US">import numal.*;</SPAN>

<SPAN LANG="en-US">public class Test_eigcom extends Object {</SPAN>
<SPAN LANG="en-US">	</SPAN>
<SPAN LANG="en-US">	public static void main(String args[]) {</SPAN>

    <SPAN LANG="en-US">int i;</SPAN>
    <SPAN LANG="en-US">double em[] = new double[8];</SPAN>
    <SPAN LANG="en-US">double valr[] = new double[5];</SPAN>
    <SPAN LANG="en-US">double vali[] = new double[5];</SPAN>
    <SPAN LANG="en-US">double ar[][] = new double[5][5];</SPAN>
    <SPAN LANG="en-US">double ai[][] = new double[5][5];</SPAN>
    <SPAN LANG="en-US">double vr[][] = new double[5][5];</SPAN>
    <SPAN LANG="en-US">double vi[][] = new double[5][5];</SPAN>

    <SPAN LANG="en-US">ar[1][1]=ar[1][4]=ar[2][2]=ar[3][2]=ar[4][1]=ar[4][3]=</SPAN>
    <SPAN LANG="en-US">ai[1][2]=ai[1][4]=ai[2][3]=ai[3][3]=ai[4][2]=1.0;</SPAN>
    <SPAN LANG="en-US">ar[1][2]=ar[2][3]=ar[3][1]=ai[1][3]=ai[2][2]=ai[3][4]=ai[4][1]=2.0;</SPAN>
    <SPAN LANG="en-US">ar[1][3]=ar[2][1]=ar[3][3]=ar[4][2]=</SPAN>
    <SPAN LANG="en-US">ai[1][1]=ai[2][4]=ai[3][1]=ai[4][4]=3.0;</SPAN>
    <SPAN LANG="en-US">ar[2][4]=ai[2][1]=ai[4][3]=4.0;</SPAN>
    <SPAN LANG="en-US">ar[3][4]=ar[4][4]=ai[3][2]=5.0;</SPAN>
    <SPAN LANG="en-US">em[0]=5.0e-6;  em[2]=1.0e-5;  em[4]=10.0;  em[6]=10.0;</SPAN>
    <SPAN LANG="en-US">DecimalFormat fiveDigit = new DecimalFormat(&quot;0.00000E0&quot;);</SPAN>
    <SPAN LANG="en-US">System.out.println(&quot;EIGCOM:  &quot; +</SPAN>
      <SPAN LANG="en-US">Linear_algebra.eigcom(ar,ai,4,em,valr,vali,vr,vi));</SPAN>
    <SPAN LANG="en-US">System.out.println(&quot;\nEigenvalues:&quot;);</SPAN>
    <SPAN LANG="en-US">for (i=1; i&lt;=4; i++)</SPAN>
      <SPAN LANG="en-US">System.out.println(&quot;\t&quot; + fiveDigit.format(valr[i]) +</SPAN>
        <SPAN LANG="en-US">&quot;\t&quot; + fiveDigit.format(vali[i]) + &quot; * I &quot;);</SPAN>
    <SPAN LANG="en-US">System.out.println(&quot;\nFirst eigenvector:&quot;);</SPAN>
    <SPAN LANG="en-US">for (i=1; i&lt;=4; i++)</SPAN>
      <SPAN LANG="en-US">System.out.println(&quot;\t&quot; + fiveDigit.format(vr[i][1]) +</SPAN>
        <SPAN LANG="en-US">&quot;\t&quot; + fiveDigit.format(vi[i][1]));</SPAN>
    <SPAN LANG="en-US">System.out.println(</SPAN>
      <SPAN LANG="en-US">&quot;\nEM[1]:  &quot; + fiveDigit.format(em[1]) +</SPAN>
      <SPAN LANG="en-US">&quot;\nEM[3]:  &quot; + fiveDigit.format(em[3]) + </SPAN>
      <SPAN LANG="en-US">&quot;\nEM[5]:  &quot; + (int)em[5] +</SPAN>
      <SPAN LANG="en-US">&quot;\nEM[7]:  &quot; + (int)em[7]);</SPAN>
<SPAN LANG="en-US">	}</SPAN>
<SPAN LANG="en-US">}</SPAN>


</PRE>
</BODY>
</HTML>